home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / fish / 726-750 / 744 / ilist / ilist.c < prev    next >
C/C++ Source or Header  |  1995-03-18  |  4KB  |  117 lines

  1. /* $Revision Header built by KCommodity by Kai Iske *** (do not edit) ************
  2. **
  3. ** © Copyright by H.P.G
  4. **
  5. ** File             : Aztec:Source/Installer/Support/IList.c
  6. ** Created on       : Tuesday, 28-Jul-92 10:21:45
  7. ** Created by       : Hans-Peter Guenther
  8. ** Current revision : V0.01
  9. **
  10. **
  11. ** Purpose
  12. ** -------
  13. **     IList.c Version 0.1 written 1992 by H.P.G PublicDomain Version
  14. **     This is the source code for IList, which gives you simply a list of all
  15. **     currently opened screens and windows. Because of the use of Printf instead
  16. **     of printf it is OS 2.0 only. Exchange Printf with printf and you can run it
  17. **     under 1.3 1.2 too.
  18. **
  19. ** Revision V0.01
  20. ** --------------
  21. **     --- Initial release ---
  22. **
  23. *********************************************************************************/
  24. #define REVISION "0.01"        /* This is the revision number */
  25. #define REVDATE  "28-Jul-92"        /* This is the revision date */
  26.  
  27. /* compiler linker options for Manx 5.xx
  28.  
  29. cc IList
  30. ln IList -lc
  31.  
  32. */
  33.  
  34. #include <exec/types.h>
  35. #include <Intuition/Intuition.h>
  36. #include <Intuition/Intuitionbase.h>
  37. #include <functions.h>
  38.  
  39. int Enable_Abort=0;
  40. VOID _abort(VOID) {}   /* disables ^C handling */
  41.  
  42. #define IB IntuitionBase
  43. struct  IB *IB=NULL;
  44.  
  45. VOID main(int argc,char **argv)
  46.     {
  47.     register struct Screen *Scr;  /* Screen Pointer */
  48.     register struct Window *Wd;   /* Window Pointer */
  49.     register LONG i=1,u=1;        /* Counter Vars   */
  50.     ULONG ilock;                  /* IntuitionLock  */
  51.  
  52.     if (argv) exit(0);
  53.                     /* I used a special startup code not the normal _main  */
  54.                     /* startup. If you want to recompile it, you have to   */
  55.                     /* exchange this lines to something like:              */
  56.                     /*  if (argc==0) exit(0);                              */
  57.                     /* I my startup I have disbales the cliparsing because */
  58.                     /* of the use of the ReadArgs functions. So argv will  */
  59.                     /* only contain anything, when started from WBench     */
  60.  
  61.                     /* If you started this program from WBench and the Icon*/
  62.                     /* contains a tooltype entry with `CLI` the WBench     */
  63.                     /* first prompts you to enter the arguments and then   */
  64.                     /* starts the tool as an cli program                   */
  65.  
  66.     if (!(IB=(struct IB *)OpenLibrary("intuition.library",36L))) exit(0);
  67.  
  68.     /* if you want to recompile for kickstart versions < 2.0 you can   */
  69.     /* exchange the 36L to 0L . Then you have to exchange the Printf   */
  70.     /* function calls to printf from the c.libs ones                   */
  71.  
  72.     ilock=LockIBase(1L); /* We got the IntuitionLock */
  73.  
  74.     if (!(Scr=(struct Screen *)IB->FirstScreen)) goto x1;
  75.     /* check if we got the first Screen if not -> exit */
  76.     do  {
  77.         Printf("%ld.\033[32m Screen: %20s \033[31m\n"
  78.                "-------------------------------------------------------------------------\n"
  79.                "\tLeftEdge: %ld TopEdge: %ld Width: %ld Height: %ld\n"
  80.                "\tFlags: %ld\n",
  81.                i,
  82.                Scr->Title,
  83.                Scr->LeftEdge,
  84.                Scr->TopEdge,
  85.                Scr->Width,
  86.                Scr->Height,
  87.                Scr->Flags);
  88.         /* putting out the screen data */
  89.         if (Wd=(struct Window *)Scr->FirstWindow)
  90.             {
  91.             do {
  92.                Printf("\t%ld.\033[32m Window: %15s\033[31m \n"
  93.                       "\t\tLeftEdge: %ld TopEdge: %ld Width: %ld Height: %ld\n"
  94.                       "\t\tWindowFlags: %ld IDCMPFlags: %ld\n",
  95.                       u,Wd->Title,
  96.                       Wd->LeftEdge,
  97.                       Wd->TopEdge,
  98.                       Wd->Width,
  99.                       Wd->Height,
  100.                       Wd->Flags,
  101.                       Wd->IDCMPFlags);
  102.                /* putting out the window data */
  103.                u++;
  104.                }while(Wd=(struct Window *)Wd->NextWindow);
  105.             } /* if */
  106.         u=1;
  107.         i++;
  108.     }while(Scr=(struct Screen *)Scr->NextScreen);
  109.  
  110.     x1:
  111.  
  112.     UnlockIBase(ilock);                          /* Free IntuitionLock   */
  113.     if (IB) CloseLibrary((struct Library *)IB);  /* close IBase          */
  114.     exit(0);
  115.     }
  116.  
  117.